<!DOCTYPE html>
<script src="../../../../resources/testharness.js"></script>
<script src="../../../../resources/testharnessreport.js"></script>
<script src="../../../../resources/gesture-util.js"></script>
<style type="text/css">
::-webkit-scrollbar {
    width: 0px;
    height: 0px;
}

#greenbox {
  width: 100px;
  height: 2000px;
  background: green;
}
#redbox {
  width: 100px;
  height: 2000px;
  background: red;
}

</style>

<body style="margin:0">

<div id="greenbox"></div>
<div id="redbox"></div>

<p id="description"></p>
<div id="console"></div>
<script type="text/javascript">
  // Turn on smooth scrolling.
  internals.settings.setScrollAnimatorEnabled(true);

  var x = 30;
  var y = 30;
  var mouse_input = GestureSourceType.MOUSE_INPUT;

promise_test (async () => {
  await smoothScroll(1, x, y, mouse_input, 'down', SPEED_INSTANT, false, true);
  await smoothScroll(1, x, y, mouse_input, 'down', SPEED_INSTANT, false, true);
  await waitForAnimationEndTimeBased(() => {
    return document.scrollingElement.scrollTop;
  });

  assert_greater_than_equal(
    document.scrollingElement.scrollTop,
    window.innerHeight * 2 * MIN_FRACTION_TO_STEP_WHEN_PAGING
  );
});
</script>

</body>
